ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
MailScheduler.h File Reference

Upper layer of scheduler in charge of scheduling deliveries. More...

Go to the source code of this file.

Defines

#define TRUE   (1u)
#define CLEAR   (0u)
#define BITS_IN_NIBBLE   (4u)
#define BITS_IN_BYTE   (8u)
#define BITS_IN_32   (32u)
#define BITS_IN_16   (16u)
#define BYTES_IN_32   (4u)
#define BYTES_IN_16   (2u)
#define SCHED_TRIGGER_TX_ISR   (0u)
#define SCHED_INBOX_DONE_SW_ISR_1   (0u)
#define SCHED_INBOX_DONE_SW_ISR_2   (1)
#define SCHED_INBOX_DONE_SW_ISR_3   (2u)
#define SCHED_INBOX_DONE_SW_ISR_4   (3u)
#define SCHED_RESCHED_1   (5u)
#define SCHED_RESCHED_2   (6u)
#define SCHED_RESCHED_3   (7u)
#define RESCH_SRC_1   BIT0
#define RESCH_SRC_2   BIT1
#define RESCH_SRC_3   BIT2
#define SCHED_WHAT_IS_THE_TIME(XX)   XX = gu32SchedTickCount
#define SCHED_WHEN_WAS_THE_LAST_TX_DONE(XX)   XX = gu32SchedTxDoneCount
#define CLEAR_ISR_FLAG(XX)   INTC.SSCIR[XX].B.CLR = TRUE

Functions

uint8_t u8fnSchedConfig (uint32_t u32PITCnt, uint8_t u8PITCh, uint32_t u32ReSchCnt, uint8_t u8ReSchPITCh)
 Configures PIT channel u8PITCh as timer for the scheduler. It also configures a secondary channel for re-scheduling events.
uint8_t u8fnSchedEnable (uint8_t u8Enable)
 Enables or disables the message scheduler.
uint8_t u8fnSchedDSPIMailTransfer (uint8_t u8DSPIInstance, uint8_t u8CS, uint8_t u8ContCS, uint8_t u8EndOfQueueFlag, uint16_t *pu16MsgSrc, uint16_t *pu16MsgResponse, uint16_t u16Size)
 Schedules an SPI transfer for the next tick. This routine should not be interrupted by Isrs.
uint8_t u8fnSchedCompositeDSPIMailTransfer (const uint8_t u8DSPIInstance1, const uint8_t u8DSPIInstance2, const uint8_t u8CS, uint16_t *pu16MsgSrc1, uint16_t *pu16MsgSrc2, const uint16_t *pu16MsgResponse, uint16_t u16SizeAtOrigin)
 Schedules an SPI transfer for the next tick. It combines two CTAR locations to perform transfers that are either longer than 16-bits or have an unusual number of bits.
uint32_t u32fnSchedHasTimeElapsed (uint32_t u32MyTickCount)
 Returns the number of ticks since u32MyTickCount.
uint32_t u32fnSchedIsTxDone (uint32_t u32MyTickCount)
 Returns u32MyCount - the last value set by TxDone Isr.
void vfnSchedIsr (void)
 Isr to be called every time PIT expires (every time a tick occurs)
void vfnSchedInboxDoneIsr (void)
 Isr to be called when the inbox has been filled . It sorts DMA channels out.
void vfnReschedulerIsr (void)
 This routine will be invoked when the Rescheduling PIT value expires. Drivers can build on it to reschedule their message if necessary.

Variables

vuint32_t gu32SchedTickCount
vuint32_t gu32SchedTxDoneCount
vuint8_t gu8RescheduleSource
uint8_t gu8ReSchPITCh

Detailed Description

Upper layer of scheduler in charge of scheduling deliveries.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint32_t u32fnSchedHasTimeElapsed ( uint32_t  u32MyTickCount)

Returns the number of ticks since u32MyTickCount.

Parameters:
u32MyTickCount,:A particular moment in time
Returns:
Zero if no ticks have occured since u32MyTickCount, or the number of ticks elapsed otherwise.
uint32_t u32fnSchedIsTxDone ( uint32_t  u32MyTickCount)

Returns u32MyCount - the last value set by TxDone Isr.

Parameters:
u32MyTickCount,:A particular moment in time
Returns:
Zero if no ticks have occured since u32MyTickCount, or the number of ticks elapsed otherwise.
uint8_t u8fnSchedCompositeDSPIMailTransfer ( const uint8_t  u8DSPIInstance1,
const uint8_t  u8DSPIInstance2,
const uint8_t  u8CS,
uint16_t *  pu16MsgSrc1,
uint16_t *  pu16MsgSrc2,
const uint16_t *  pu16MsgResponse,
uint16_t  u16SizeAtOrigin 
)

Schedules an SPI transfer for the next tick. It combines two CTAR locations to perform transfers that are either longer than 16-bits or have an unusual number of bits.

Parameters:
u8DSPIInstance1,:SPI instance and memory to be used for the first word.
u8DSPIInstance2,:SPI instance and memory to be used for the second word.
u8CS,:Chip select to be used.
pu16MsgSrc1,:pointer to the message source for the first word
pu16MsgSrc2,:pointer to the message source for the second word
pu16MsgResponse,:pointer to the location where the response should be stored. Note that the number of words stored is that of u16SizeOfOrigin * 2
u16Size,:Size of composite transfers.
Returns:
Zero if no problems, otherwise MAILBOX_IS_BEING_WRITTEN, or MAILBOX_CAPACITY_HAS_BEEN_REACHED
uint8_t u8fnSchedConfig ( uint32_t  u32PITCnt,
uint8_t  u8PITCh,
uint32_t  u32ReSchCnt,
uint8_t  u8ReSchPITCh 
)

Configures PIT channel u8PITCh as timer for the scheduler. It also configures a secondary channel for re-scheduling events.

Parameters:
u32PITCnt,:Number of counts that must expire before creating a scheduler interrupt. Counts are at bus frequency.
u8PITCh,:Active PIT channel for scheduler. It will be stored for future use.
u32ReSchCnt,:Number of counts that must expire before creating a re-schedule interrupt.
u8ReSchPITCh,:Active PIT channel for re-scheduler.
Returns:
PIT_INVALID_CH in case any of the selected channels doesn't exist; CLEAR otherwise.
uint8_t u8fnSchedDSPIMailTransfer ( uint8_t  u8DSPIInstance,
uint8_t  u8CS,
uint8_t  u8ContCS,
uint8_t  u8EndOfQueueFlag,
uint16_t *  pu16MsgSrc,
uint16_t *  pu16MsgResponse,
uint16_t  u16Size 
)

Schedules an SPI transfer for the next tick. This routine should not be interrupted by Isrs.

Parameters:
u8DSPIInstance,:SPI instance and memory to be used.
u8CS,:Chip select to be used.
u8EndofQueueFlag,:Enable or disable EndOfQueue flag (and ISR).
pu16MsgSrc,:pointer to the message source
pu16MsgResponse,:pointer to the location where the response should be stored.
u16Size,:Size of transfer in number of words.
Returns:
Zero if no problems, otherwise MAILBOX_IS_BEING_WRITTEN.
uint8_t u8fnSchedEnable ( uint8_t  u8Enable)

Enables or disables the message scheduler.

Parameters:
u8Enable,:If non-zero, enables, otherwise disables.
Returns:
Always zero.
void vfnReschedulerIsr ( void  )

This routine will be invoked when the Rescheduling PIT value expires. Drivers can build on it to reschedule their message if necessary.

Parameters:
None
Returns:
Void
void vfnSchedInboxDoneIsr ( void  )

Isr to be called when the inbox has been filled . It sorts DMA channels out.

Parameters:
None
Returns:
Void
void vfnSchedIsr ( void  )

Isr to be called every time PIT expires (every time a tick occurs)

Parameters:
None
Returns:
void